Updated the router and dispatcher to accept routing to controllers th…#24
Open
tysonphillips wants to merge 1 commit intomasterfrom
Open
Updated the router and dispatcher to accept routing to controllers th…#24tysonphillips wants to merge 1 commit intomasterfrom
tysonphillips wants to merge 1 commit intomasterfrom
Conversation
…at implement the magic methods __call or __callStatic
clphillips
reviewed
Feb 24, 2018
| # see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/275 | ||
| # | ||
| /* | ||
| $magicController = $this->getMockBuilder('Controller') |
Contributor
There was a problem hiding this comment.
Why not create a test controller that uses magic methods and assert it works as example expected?
|
|
||
| $result = null; | ||
| if (method_exists($ctrl, $action)) { | ||
| if (method_exists($ctrl, $action) || is_callable([$ctrl, $action])) { |
Contributor
There was a problem hiding this comment.
Does it makes sense to just use 'is_callable'? Seems like that covers method_exists.
| || $reflectedObj->isSubclassOf($inheritsFrom) | ||
| ) | ||
| ); | ||
| } catch (Exception $e) { |
Contributor
There was a problem hiding this comment.
What Exception instance is possible here? Should probably catch the most specific avalable.
| } catch (ReflectionException $e) { | ||
| return false; | ||
| } catch (Exception $e) { | ||
| return false; |
Contributor
There was a problem hiding this comment.
not sure what this catch adds.
| && !in_array(strtolower($method), $publicUncallables) | ||
| && ( | ||
| $inheritsFrom === null | ||
| || $reflectedObj->getName() == $inheritsFrom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…at implement the magic methods __call or __callStatic
Fixes #23